import { defineStore } from "pinia";

export const userStore = defineStore("user", {
  // 状态数据
  state: () => {
    return {
      user_email: "123@qq.com",
      user_age: 18,
    };
  },
  //   计算属性
  getters: {
    grow_age() {
      return this.user_age + 1;
    },
  },
  //   操作方法
  actions: {
    update_age(val) {
      this.user_age += val;
    },
  },
});
